package com.ruoyi.wcf.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.wcf.domain.WcfPlateManage;
import com.ruoyi.wcf.service.IWcfPlateManageService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 展示板块管理Controller
 * 
 * @author LCL
 * @date 2022-04-06
 */
@RestController
@RequestMapping("/wcf/WcfPlateManage")
public class WcfPlateManageController extends BaseController
{
    @Autowired
    private IWcfPlateManageService wcfPlateManageService;

    /**
     * 查询展示板块管理列表
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfPlateManage:list')")
    @GetMapping("/list")
    public TableDataInfo list(WcfPlateManage wcfPlateManage)
    {
        startPage();
        List<WcfPlateManage> list = wcfPlateManageService.selectWcfPlateManageList(wcfPlateManage);
        return getDataTable(list);
    }

    /**
     * 导出展示板块管理列表
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfPlateManage:export')")
    @Log(title = "展示板块管理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WcfPlateManage wcfPlateManage)
    {
        List<WcfPlateManage> list = wcfPlateManageService.selectWcfPlateManageList(wcfPlateManage);
        ExcelUtil<WcfPlateManage> util = new ExcelUtil<WcfPlateManage>(WcfPlateManage.class);
        return util.exportExcel(list, "展示板块管理数据");
    }

    /**
     * 获取展示板块管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfPlateManage:query')")
    @GetMapping(value = "/{plateId}")
    public AjaxResult getInfo(@PathVariable("plateId") Long plateId)
    {
        return AjaxResult.success(wcfPlateManageService.selectWcfPlateManageByPlateId(plateId));
    }

    /**
     * 新增展示板块管理
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfPlateManage:add')")
    @Log(title = "展示板块管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WcfPlateManage wcfPlateManage)
    {
        return toAjax(wcfPlateManageService.insertWcfPlateManage(wcfPlateManage));
    }

    /**
     * 修改展示板块管理
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfPlateManage:edit')")
    @Log(title = "展示板块管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WcfPlateManage wcfPlateManage)
    {
        return toAjax(wcfPlateManageService.updateWcfPlateManage(wcfPlateManage));
    }

    /**
     * 删除展示板块管理
     */
    @PreAuthorize("@ss.hasPermi('wcf:WcfPlateManage:remove')")
    @Log(title = "展示板块管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{plateIds}")
    public AjaxResult remove(@PathVariable Long[] plateIds)
    {
        return toAjax(wcfPlateManageService.deleteWcfPlateManageByPlateIds(plateIds));
    }
}
